<?php
// +----------------------------------------------------------------------
// | quanli team
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.fistforward.com/ All rights reserved.
// +----------------------------------------------------------------------
// | create by allen.qiang
// +----------------------------------------------------------------------


/**
 * 任务管理功能
 * @package  htdocs
 * @subpackage  quanliadmin
 * @create by allen.qiang
 */

quanli_require('module/base/taskHandler.class.php');

class pa_assignment{
	
	public function execute() {

        if (isset($_REQUEST['operFlg']) && is_numeric($_REQUEST['operFlg']) && $_REQUEST['operFlg'] > 0) {

            switch ($_REQUEST['operFlg']) {

                case 1: //任务管理页
                    $this->assignmentList();
                    break;

                case 2: //任务新增或修改
                    $this->edit();
                    break;

                default:
                    $this->toError('参数错误');
                    break;
            }

        } else {

            $this->toError('参数错误');

        }

	}

    /**
     * 转跳到错误页面
     * @param string $msg 错误信息
     */
    private function toError( $msg = '' ) {

        global $G_PGLOB;

        $G_PGLOB->display_error_page( $msg );

    }
	
	//任务列表页
	private function assignmentList() {

		global $G_PGLOB;

		$G_PGLOB->smarty->display('project/assignmentList.tpl');

	}

    /**
     * 任务新增或修改
     */
    private function edit() {

		global $G_PGLOB;

        //实例化任务类
        $taskManagerObj = new taskManager($G_PGLOB->DBCA);

        if (isset($_REQUEST['taskId']) && $_REQUEST['taskId'] > 0) {

            //查询任务信息
            $arg_array = array(
                'taskId' => $_REQUEST['taskId']
            );
            $taskObjList=$taskManagerObj->query($arg_array);

            $G_PGLOB->smarty->assign_by_ref('taskObjList', $taskObjList[0]);

        }
        $day = range(1, 30);
        $G_PGLOB->smarty->assign_by_ref('day', $day);
		$G_PGLOB->smarty->display('project/assignment.tpl');

	}


}